# -*- coding: utf-8 -*-
# @Time    : 2022/7/16 14:06
# @Author  : feng
# @Email   : feng@163.com
# @File    : xsfp_page.py
# @Software: PyCharm
from selenium.webdriver.common.by import By
from pages.login_page import LoginPage
from pages.base_page import BasePage

class XsfpPage(BasePage):
    '''进入线索分配页面'''
    url='http://192.168.1.5:8081/crm/index.php?m=leads&a=index&by=public'
    '''定位器'''
    top_locator=(By.CSS_SELECTOR,"body > div.navbar.navbar-inverse.navbar-fixed-top > div")
    xiansuo_locator=(By.LINK_TEXT,'线索')

    xiansuochi_locator=(By.CSS_SELECTOR,'body > div.container > div.page-header > ul > li:nth-child(2) > a')

    lingqu_locator=(By.LINK_TEXT,"领取")

    fenpei_locator=(By.LINK_TEXT,'分配')

    xm_locator=(By.ID,'owner_name') #页面切换

    qh_locator=(By.ID,'dialog-fenpei')

    choose_locator=(By.NAME,'owner')

    sure_locator=(By.CSS_SELECTOR,'body > div:nth-child(15) > div.ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix > div > button:nth-child(1)')

    ok_locator=(By.CSS_SELECTOR,'body > div:nth-child(11) > div.ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix > div > button:nth-child(1) > span')

    #进入最上面切换
    def switch_top(self):
        self.driver.find_element(*self.top_locator)
    #点击线索池
    def click_xiansuo(self):
        self.driver.find_element(*self.xiansuo_locator).click()
    def click_xiansuochi(self):
        self.driver.find_element(*self.xiansuochi_locator).click()
        #点击分配线索
    def click_fenpei(self):
        self.driver.find_element(*self.fenpei_locator).click() #点击分配
    def click_xm(self):
        self.driver.find_element(*self.xm_locator).click() #选择分配员工
    def click_choose(self):
        self.driver.find_element(*self.choose_locator).click() #选择员工
    def click_sure(self):
        self.driver.find_element(*self.sure_locator).click()#点击分配
    def click_ok(self):
        self.driver.find_element(*self.ok_locator).click() #点击OK


